<template>
    <div class="student">
        <h3>学生姓名:{{ props.name }}</h3>
        <h3>学生性别:{{ props.sex }}</h3>
        <h3>学生年龄:{{ props.age }}</h3>
        <h3>等级：{{ degree }}</h3>
        <h3>{{ tname }}</h3>
    </div>
</template>

<script setup>
import { inject, onMounted, ref, } from 'vue';
const props=defineProps(['name','sex','age'])


console.log(props);

const degree=inject('degree')
console.log(degree);

const tname=ref('')
const $bus =inject('$bus')
onMounted(()=>{
    $bus.on('setTname',(val)=>{
        tname.value=val
    })
})

</script>